<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.6.0.min.js"></script>
    <script>

        $(function () {

            $("input[type=button]").click(function () {
                let str = $("#arr").val();
                let ele = $("#ele").val();
                let ss = str.split(",");
                for (let i = 0; i < ss.length; i++) {
                    if (ss[i] === ele) {
                        alert(ele+"在数组["+str+"]的索引的位置是："+i)
                        break
                    }
                }
            })


        })

    </script>
</head>
<body>
字符串数组格式：（a,哈哈,3）：<input type="text" id="arr"/>
要查找的元素：<input type="text" id="ele"/>
<input type="button" value="开始查找"/>
</body>
</html>